<template>
  <div>
    <el-table :data="memberlist" border style="width: 100%">
      <el-table-column prop="uid" label="用户编号" width="180"> </el-table-column>
      <el-table-column prop="nickname" label="昵称" width="180"> </el-table-column>
      <el-table-column prop="phone" label="手机号" width="180"> </el-table-column>
      <el-table-column label="状态">
        <template slot-scope="item">
          <div>
            <el-tag v-if="item.row.status == 1" type="success">启用</el-tag>
            <el-tag v-else type="danger">禁用</el-tag>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="item">
          <div>
            <el-button 
            @click="edit(item.row.uid)" 
            type="primary" 
            size="mini" 
            circle 
            icon="el-icon-edit"
            ></el-button>
          </div>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @current-change="changepage" :page-size="pageSize" background layout="prev, pager, next" :total="count">
    </el-pagination>
  </div>
</template>

<script>
import { mapActions, mapGetters } from 'vuex';
export default {
  data() {
    return {

    };
  },
  computed: {
    ...mapGetters({
      memberlist: 'member/getMember',
      pageSize:'member/getSize',
      count:'member/getCount'
    })
  },
  mounted() {
    this.getMemberAction();
    this.getCount()
  },
  methods: {
    edit(id) {
      this.$emit('edit', id)
    },
    ...mapActions({
      getMemberAction: 'member/getMemberAction',
      getCount:'member/getCountAction',
      changePageAction:'member/changePageAction'
    }),
    //求换页面事件
    changepage(n){
      console.log(n);
      this.changePageAction(n)
    }
  }
};
</script>

<style scoped>

</style>
